package com.b2.controller.wx;

import com.b2.pojo.dto.*;
import com.b2.pojo.vo.DirectorGetworksVo;
import com.b2.pojo.vo.DirectorVideoInformation;
import com.b2.pojo.vo.ParentVideoInformation;
import com.b2.pojo.vo.adminGetworksVo;
import com.b2.result.Result;
import com.b2.service.DirectorService;
import com.b2.service.DirectorVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wx/directorvideo")
@Slf4j
@Api(tags = "园长上传视频及其管理员处理相关接口")
@CrossOrigin
public class DirectorVideoController {

    @Autowired
    DirectorVideoService directorVideoService;

    @PostMapping("commitvideo")
    public Result directorcommitvideo(@RequestBody DirectorCommitVideoDto directorCommitVideoDto){
        directorVideoService.directorcommitvideo(directorCommitVideoDto);
        return Result.success();
    }

    @GetMapping("getinformation")
    public Result<DirectorVideoInformation> getinformation(Long videoid){
        DirectorVideoInformation directorVideoInformation= directorVideoService.getinformation(videoid);
        return Result.success(directorVideoInformation);
    }


    //查看是否可以修改
    @GetMapping("getstatus")
    public Result<Integer> getstatus( Long id){
        Integer status= directorVideoService.getstatus(id);
        return Result.success(status);
    }

    @PostMapping ("updatevideo")
    public Result directorupdatevideo(@RequestBody DirectorUpdateVideoDto directorUpdateVideoDto){

        directorVideoService.directorupdatevideo(directorUpdateVideoDto);
        return Result.success();
    }

    //管理员得到工作
    @PostMapping ("admingetworks")
    public Result<List<adminGetworksVo>> admingetworks(@RequestBody adminGetWorksDto adminGetWorksDto){

        List<adminGetworksVo> adminGetworksVos=  directorVideoService.admingetworks(adminGetWorksDto);
        return Result.success(adminGetworksVos);
    }

    @PostMapping("getAiresponse")
    public String getAiresponse(@RequestBody AiDto aiDto){
        String AIresponse= directorVideoService.getAiresponse(aiDto);
        return AIresponse;
    }

    @PostMapping("putadminResponse")
    public Result putadminResponse(@RequestBody adminResponseDto dto){
        directorVideoService.putadminResponse(dto);
        return Result.success();
    }

    @PostMapping("adminUpdateStatus")
    public Result adminUpdateStatus(@RequestBody AdminOverruleDto adminOverruleDto){
        directorVideoService.adminUpdateStatus(adminOverruleDto.getId(),adminOverruleDto.getOverrule());
        return Result.success();
    }
}
